<template>
  <div id="userSearchPage">
    <HeadNav type="inquire" ref="head" :show="1"></HeadNav>
    <div class="wd-1220">
      <div class="clearfix">
        <div class="float-left">
          <SlideNav type="inquire" sort="userportrait"></SlideNav>
        </div>
        <div class="float-right">
          <div class="main-container" v-if="pagePower">
            <div class="model-container">
              <div class="model-bg">
                <div class="section-title">
                  <a-tabs :activeKey="tabKey" @change="callback">
                    <a-tab-pane key="1" tab="检索用户"></a-tab-pane>
                    <a-tab-pane key="2" tab="用户分群"></a-tab-pane>
                  </a-tabs>
                </div>
              </div>
              <!-- 检索用户--检索条件 -->
              <div class="model-container" v-if="tabKey == '1'">
                <div class="model-bg">
                  <div class="section-title">检索条件</div>
                  <div class="condition-container">
                    <div class="condition-content">
                      <div
                        class="condition-container-left"
                        @click="relaType = relaType == 'and' ? 'or' : 'and'"
                      >
                        {{ relaType == "and" ? "且" : "或" }}
                      </div>
                      <!-- 用户属性 -->
                      <div class="condition-list">
                        <div class="condition-list-item">
                          <span class="condition-list-text">用户属性满足</span>
                          <a-button @click="addList('user', 'one')"
                            >添加</a-button
                          >
                        </div>
                        <!-- 二级 -->
                        <div
                          :class="[
                            'condition-list level',
                            conditionList.length > 1 ? 'two' : '',
                          ]"
                          v-if="conditionList.length > 0"
                        >
                          <div
                            class="condition-container-left"
                            v-if="conditionList.length > 1"
                            @click="
                              userRelaType =
                                userRelaType == 'and' ? 'or' : 'and'
                            "
                          >
                            {{ userRelaType == "and" ? "且" : "或" }}
                          </div>
                          <div
                            :style="{
                              'margin-bottom':
                                conditionList.length > 1 ? '10px' : '',
                            }"
                            v-for="(item, index) in conditionList"
                            :key="index"
                          >
                            <div
                              class="condition-list-item"
                              v-if="conditionList[index].children.length == 0"
                            >
                              <div>
                                <a-select
                                  v-model="item.targID"
                                  style="width: 160px"
                                  @change="
                                    (value) =>
                                      handleTargeChange(value, 'one', index)
                                  "
                                >
                                  <a-select-option
                                    v-for="(aitem, aindex) in attributeList"
                                    :key="aindex"
                                    :value="aitem.tag_id"
                                  >
                                    {{ aitem.name }}
                                  </a-select-option>
                                </a-select>
                                <!-- 数值 -->
                                <template
                                  v-if="
                                    item.searchType == 1 || item.searchType == 5
                                  "
                                >
                                  <a-select
                                    v-model="item.numType"
                                    style="width: 140px"
                                    @change="
                                      (value) =>
                                        handleNumChange(value, 'one', index)
                                    "
                                  >
                                    <a-select-option
                                      v-for="(sitem, sindex) in numList"
                                      :key="sindex"
                                      :value="sitem.id"
                                      >{{ sitem.name }}</a-select-option
                                    >
                                  </a-select>
                                </template>
                                <!-- 字符串或字典 -->
                                <template
                                  v-if="
                                    item.searchType == 2 || item.searchType == 4
                                  "
                                >
                                  <a-select
                                    v-model="item.strType"
                                    style="width: 140px"
                                    @change="
                                      (value) =>
                                        handleStrChange(value, 'one', index)
                                    "
                                  >
                                    <a-select-option
                                      v-for="(sitem, sindex) in strList"
                                      :key="sindex"
                                      :value="sitem.id"
                                      >{{ sitem.name }}</a-select-option
                                    >
                                  </a-select>
                                </template>
                                <!-- 时间 -->
                                <template v-if="item.searchType == 3">
                                  <a-select
                                    v-model="item.timeType"
                                    style="width: 140px"
                                    @change="
                                      (value) =>
                                        handleTimeChange(value, 'one', index)
                                    "
                                  >
                                    <a-select-option
                                      v-for="(sitem, sindex) in timeList"
                                      :key="sindex"
                                      :value="sitem.id"
                                      >{{ sitem.name }}</a-select-option
                                    >
                                  </a-select>
                                </template>
                                <!-- 数值 -->
                                <template
                                  v-if="
                                    item.searchType == 1 || item.searchType == 5
                                  "
                                >
                                  <a-input-number v-if="
                                      item.numType == 1 ||
                                      item.numType == 2 ||
                                      item.numType == 3 ||
                                      item.numType == 4 ||
                                      item.numType == 5 ||
                                      item.numType == 6
                                    "
                                    class="input" :min="0" v-model="item.numVal" @change="
                                      (value) =>
                                        inputChange(value, 'one', 'numVal', index)
                                    " />
                                  <template v-if="item.numType == 7">
                                    <span class="devider-text">在</span>
                                    <a-input-number
                                    class="input" :min="0" v-model="item.numSval" @change="
                                      (value) =>
                                        inputChange(value, 'one', 'numSval', index)
                                    " />
                                    <span class="devider-text">到</span>
                                    <a-input-number
                                    class="input" :min="0" v-model="item.numEval" @change="
                                      (value) =>
                                        inputChange(value, 'one', 'numEval', index)
                                    " />
                                    <span class="devider-text">之间</span>
                                  </template>
                                </template>
                                <!-- 字符串或字典 -->
                                <template
                                  v-else-if="
                                    item.searchType == 2 || item.searchType == 4
                                  "
                                >
                                  <template
                                    v-if="
                                      item.strType == 1 || item.strType == 2
                                    "
                                  >
                                    <a-select
                                      mode="multiple"
                                      style="width: 400px"
                                      v-model="item.chooseID"
                                      @change="
                                        (value) =>
                                          selectChange(
                                            value,
                                            'one',
                                            item,
                                            index
                                          )
                                      "
                                      placeholder="选择标签"
                                    >
                                      <a-select-option
                                        v-for="kitem in item.selectList"
                                        :key="kitem.id"
                                        :value="kitem.name"
                                        >{{ kitem.name }}</a-select-option
                                      >
                                    </a-select>
                                  </template>
                                </template>
                                <!-- 时间 -->
                                <template v-else-if="item.searchType == 3">
                                  <template v-if="item.timeType == 1">
                                    <span class="devider-text">在</span>
                                    <a-range-picker
                                      inputReadOnly
                                      :value="[item.stime, item.etime]"
                                      @change="
                                        (date) => onChange(date, 'one', index)
                                      "
                                    />
                                    <span class="devider-text">之间</span>
                                  </template>
                                  <template v-if="item.timeType == 2">
                                    <span class="devider-text">在</span>
                                    <a-input-number
                                    class="input width60" :min="0" v-model="item.timeval" @change="
                                      (value) =>
                                        inputChange(value, 'one', 'timeval', index)
                                    " />
                                    <span class="devider-text">天</span>
                                    <a-select
                                      v-model="item.rangeType"
                                      style="width: 80px"
                                    >
                                      <a-select-option value="1"
                                        >之内</a-select-option
                                      >
                                      <a-select-option value="2"
                                        >之前</a-select-option
                                      >
                                    </a-select>
                                  </template>
                                  <template v-if="item.timeType == 3">
                                    <span class="devider-text">在过去</span>
                                    <a-input-number
                                    class="input width60" :min="0" v-model="item.numSval" @change="
                                      (value) =>
                                        inputChange(value, 'one', 'numSval', index)
                                    " />
                                    <span class="devider-text">天到过去</span>
                                    <a-input-number
                                    class="input width60" :min="0" v-model="item.numEval" @change="
                                      (value) =>
                                        inputChange(value, 'one', 'numEval', index)
                                    " />
                                    <span class="devider-text">天之内</span>
                                  </template>
                                  <template v-if="item.timeType == 4">
                                    <span class="devider-text">在</span>
                                    <a-date-picker
                                      inputReadOnly
                                      v-model="item.timestamp"
                                      @change="
                                        (date) =>
                                          timeOnChange(date, 'one', index)
                                      "
                                    />
                                    <a-select
                                      v-model="item.rangeType1"
                                      style="width: 80px; margin-left: 5px"
                                    >
                                      <a-select-option value="1"
                                        >之前</a-select-option
                                      >
                                      <a-select-option value="2"
                                        >之后</a-select-option
                                      >
                                    </a-select>
                                  </template>
                                </template>
                              </div>
                              <span class="condition-list-icon">
                                <a-icon
                                  type="plus-square"
                                  style="cursor: pointer"
                                  @click="addList('user', 'two', index)"
                                />
                                <svg
                                  class="icon"
                                  aria-hidden="true"
                                  style="cursor: pointer; margin-left: 10px"
                                  @click="delList('one', index)"
                                >
                                  <use xlink:href="#icon-shanchu" />
                                </svg>
                              </span>
                            </div>
                            <!-- 三级 -->
                            <div
                              :class="[
                                'condition-list level',
                                item.children.length > 0 ? 'three' : '',
                              ]"
                              v-if="
                                item &&
                                item.children &&
                                item.children.length > 0
                              "
                            >
                              <div
                                class="condition-container-left"
                                v-if="item.children.length > 0"
                                @click="checkType(index)"
                              >
                                {{ item.realType == "and" ? "且" : "或" }}
                              </div>
                              <div class="condition-list-item">
                                <div>
                                  <a-select
                                    v-model="item.targID"
                                    style="width: 160px"
                                    @change="
                                      (value) =>
                                        handleTargeChange(value, 'one', index)
                                    "
                                  >
                                    <a-select-option
                                      v-for="(aitem, aindex) in attributeList"
                                      :key="aindex"
                                      :value="aitem.tag_id"
                                    >
                                      {{ aitem.name }}
                                    </a-select-option>
                                  </a-select>
                                  <!-- 数值 -->
                                  <template
                                    v-if="
                                      item.searchType == 1 ||
                                      item.searchType == 5
                                    "
                                  >
                                    <a-select
                                      v-model="item.numType"
                                      style="width: 140px"
                                      @change="
                                        (value) =>
                                          handleNumChange(value, 'one', index)
                                      "
                                    >
                                      <a-select-option
                                        v-for="(sitem, sindex) in numList"
                                        :key="sindex"
                                        :value="sitem.id"
                                        >{{ sitem.name }}</a-select-option
                                      >
                                    </a-select>
                                  </template>
                                  <!-- 字符串或字典 -->
                                  <template
                                    v-if="
                                      item.searchType == 2 ||
                                      item.searchType == 4
                                    "
                                  >
                                    <a-select
                                      v-model="item.strType"
                                      @change="
                                        (value) =>
                                          handleStrChange(value, 'one', index)
                                      "
                                      style="width: 140px"
                                    >
                                      <a-select-option
                                        v-for="(sitem, sindex) in strList"
                                        :key="sindex"
                                        :value="sitem.id"
                                        >{{ sitem.name }}</a-select-option
                                      >
                                    </a-select>
                                  </template>
                                  <!-- 时间 -->
                                  <template v-if="item.searchType == 3">
                                    <a-select
                                      v-model="item.timeType"
                                      style="width: 140px"
                                      @change="
                                        (value) =>
                                          handleTimeChange(value, 'one', index)
                                      "
                                    >
                                      <a-select-option
                                        v-for="(sitem, sindex) in timeList"
                                        :key="sindex"
                                        :value="sitem.id"
                                        >{{ sitem.name }}</a-select-option
                                      >
                                    </a-select>
                                  </template>
                                  <!-- 数值 -->
                                  <template
                                    v-if="
                                      item.searchType == 1 ||
                                      item.searchType == 5
                                    "
                                  >
                                    <a-input-number v-if="
                                        item.numType == 1 ||
                                        item.numType == 2 ||
                                        item.numType == 3 ||
                                        item.numType == 4 ||
                                        item.numType == 5 ||
                                        item.numType == 6
                                      "
                                    class="input" :min="0" v-model="item.numVal" @change="
                                      (value) =>
                                        inputChange(value, 'one', 'numVal', index)
                                    " />
                                    <template v-if="item.numType == 7">
                                      <span class="devider-text">在</span>
                                      <a-input-number
                                    class="input" :min="0" v-model="item.numSval" @change="
                                      (value) =>
                                        inputChange(value, 'one', 'numSval', index)
                                    " />
                                      <span class="devider-text">到</span>
                                      <a-input-number
                                    class="input" :min="0" v-model="item.numEval" @change="
                                      (value) =>
                                        inputChange(value, 'one', 'numEval', index)
                                    " />
                                      <span class="devider-text">之间</span>
                                    </template>
                                  </template>
                                  <!-- 字符串或字典 -->
                                  <template
                                    v-if="
                                      item.searchType == 2 ||
                                      item.searchType == 4
                                    "
                                  >
                                    <template
                                      v-if="
                                        item.strType == 1 || item.strType == 2
                                      "
                                    >
                                      <a-select
                                        mode="multiple"
                                        style="width: 400px"
                                        v-model="item.chooseID"
                                        @change="
                                          (value) =>
                                            selectChange(
                                              value,
                                              'one',
                                              item,
                                              index
                                            )
                                        "
                                        placeholder="选择标签"
                                      >
                                        <a-select-option
                                          v-for="kitem in item.selectList"
                                          :key="kitem.id"
                                          :value="kitem.name"
                                          >{{ kitem.name }}</a-select-option
                                        >
                                      </a-select>
                                    </template>
                                  </template>
                                  <!-- 时间 -->
                                  <template v-if="item.searchType == 3">
                                    <template v-if="item.timeType == 1">
                                      <span class="devider-text">在</span>
                                      <a-range-picker
                                        inputReadOnly
                                        :value="[item.stime, item.etime]"
                                        @change="
                                          (date) => onChange(date, 'one', index)
                                        "
                                      />
                                      <span class="devider-text">之间</span>
                                    </template>
                                    <template v-if="item.timeType == 2">
                                      <span class="devider-text">在</span>
                                      <a-input-number
                                    class="input width60" :min="0" v-model="item.timeval" @change="
                                      (value) =>
                                        inputChange(value, 'one', 'timeval', index)
                                    " />
                                      <span class="devider-text">天</span>
                                      <a-select
                                        v-model="item.rangeType"
                                        style="width: 80px"
                                      >
                                        <a-select-option value="1"
                                          >之内</a-select-option
                                        >
                                        <a-select-option value="2"
                                          >之前</a-select-option
                                        >
                                      </a-select>
                                    </template>
                                    <template v-if="item.timeType == 3">
                                      <span class="devider-text">在过去</span>
                                      <a-input-number
                                    class="input width60" :min="0" v-model="item.numSval" @change="
                                      (value) =>
                                        inputChange(value, 'one', 'numSval', index)
                                    " />
                                      <span class="devider-text">天到过去</span>
                                      <a-input-number
                                    class="input width60" :min="0" v-model="item.numEval" @change="
                                      (value) =>
                                        inputChange(value, 'one', 'numEval', index)
                                    " />
                                      <span class="devider-text">天之内</span>
                                    </template>
                                    <template v-if="item.timeType == 4">
                                      <span class="devider-text">在</span>
                                      <a-date-picker
                                        inputReadOnly
                                        v-model="item.timestamp"
                                        @change="
                                          (date) =>
                                            timeOnChange(date, 'one', index)
                                        "
                                      />
                                      <a-select
                                        v-model="item.rangeType1"
                                        style="width: 80px; margin-left: 5px"
                                      >
                                        <a-select-option value="1"
                                          >之前</a-select-option
                                        >
                                        <a-select-option value="2"
                                          >之后</a-select-option
                                        >
                                      </a-select>
                                    </template>
                                  </template>
                                </div>
                                <span class="condition-list-icon">
                                  <svg
                                    class="icon"
                                    aria-hidden="true"
                                    style="cursor: pointer; margin-left: 10px"
                                    @click="delList('two', index, -1)"
                                  >
                                    <use xlink:href="#icon-shanchu" />
                                  </svg>
                                </span>
                              </div>
                              <div
                                class="condition-list-item"
                                v-for="(citem, cindex) in item.children"
                                :key="cindex"
                              >
                                <div>
                                  <a-select
                                    v-model="citem.targID"
                                    @change="
                                      (value) =>
                                        handleTargeChange(
                                          value,
                                          'two',
                                          index,
                                          cindex
                                        )
                                    "
                                    style="width: 160px"
                                  >
                                    <a-select-option
                                      v-for="(aitem, aindex) in attributeList"
                                      :key="aindex"
                                      :value="aitem.tag_id"
                                    >
                                      {{ aitem.name }}
                                    </a-select-option>
                                  </a-select>
                                  <!-- 数值 -->
                                  <template
                                    v-if="
                                      citem.searchType == 1 ||
                                      citem.searchType == 5
                                    "
                                  >
                                    <a-select
                                      v-model="citem.numType"
                                      style="width: 140px"
                                      @change="
                                        (value) =>
                                          handleNumChange(
                                            value,
                                            'two',
                                            index,
                                            cindex
                                          )
                                      "
                                    >
                                      <a-select-option
                                        v-for="(sitem, sindex) in numList"
                                        :key="sindex"
                                        :value="sitem.id"
                                        >{{ sitem.name }}</a-select-option
                                      >
                                    </a-select>
                                  </template>
                                  <!-- 字符串或字典 -->
                                  <template
                                    v-if="
                                      citem.searchType == 2 ||
                                      citem.searchType == 4
                                    "
                                  >
                                    <a-select
                                      v-model="citem.strType"
                                      @change="
                                        (value) =>
                                          handleStrChange(
                                            value,
                                            'two',
                                            index,
                                            cindex
                                          )
                                      "
                                      style="width: 140px"
                                    >
                                      <a-select-option
                                        v-for="(sitem, sindex) in strList"
                                        :key="sindex"
                                        :value="sitem.id"
                                        >{{ sitem.name }}</a-select-option
                                      >
                                    </a-select>
                                  </template>
                                  <!-- 时间 -->
                                  <template v-if="citem.searchType == 3">
                                    <a-select
                                      v-model="citem.timeType"
                                      style="width: 140px"
                                      @change="
                                        (value) =>
                                          handleTimeChange(
                                            value,
                                            'two',
                                            index,
                                            cindex
                                          )
                                      "
                                    >
                                      <a-select-option
                                        v-for="(sitem, sindex) in timeList"
                                        :key="sindex"
                                        :value="sitem.id"
                                        >{{ sitem.name }}</a-select-option
                                      >
                                    </a-select>
                                  </template>
                                  <!-- 数值 -->
                                  <template
                                    v-if="
                                      citem.searchType == 1 ||
                                      citem.searchType == 5
                                    "
                                  >
                                    <a-input-number v-if="
                                        citem.numType == 1 ||
                                        citem.numType == 2 ||
                                        citem.numType == 3 ||
                                        citem.numType == 4 ||
                                        citem.numType == 5 ||
                                        citem.numType == 6
                                      "
                                    class="input" :min="0" v-model="citem.numVal" @change="
                                      (value) =>
                                        inputChange(value, 'two', 'numVal', index,cindex)
                                    " />
                                    <template v-if="citem.numType == 7">
                                      <span class="devider-text">在</span>
                                      <a-input-number
                                    class="input" :min="0" v-model="citem.numSval" @change="
                                      (value) =>
                                        inputChange(value, 'two', 'numSval', index,cindex)
                                    " />
                                      <span class="devider-text">到</span>
                                      <a-input-number
                                    class="input" :min="0" v-model="citem.numEval" @change="
                                      (value) =>
                                        inputChange(value, 'two', 'numEval', index,cindex)
                                    " />
                                      <span class="devider-text">之间</span>
                                    </template>
                                  </template>
                                  <!-- 字符串或字典 -->
                                  <template
                                    v-if="
                                      citem.searchType == 2 ||
                                      citem.searchType == 4
                                    "
                                  >
                                    <template
                                      v-if="
                                        citem.strType == 1 || citem.strType == 2
                                      "
                                    >
                                      <a-select
                                        mode="multiple"
                                        style="width: 400px"
                                        v-model="citem.chooseID"
                                        @change="
                                          (value) =>
                                            selectChange(
                                              value,
                                              'two',
                                              citem,
                                              index,
                                              cindex
                                            )
                                        "
                                        placeholder="选择标签"
                                      >
                                        <a-select-option
                                          v-for="kitem in citem.selectList"
                                          :key="kitem.id"
                                          :value="kitem.name"
                                          >{{ kitem.name }}</a-select-option
                                        >
                                      </a-select>
                                    </template>
                                  </template>
                                  <!-- 时间 -->
                                  <template v-if="citem.searchType == 3">
                                    <template v-if="citem.timeType == 1">
                                      <span class="devider-text">在</span>
                                      <a-range-picker
                                        inputReadOnly
                                        :value="[citem.stime, citem.etime]"
                                        @change="
                                          (date) =>
                                            onChange(date, 'two', index, cindex)
                                        "
                                      />
                                      <span class="devider-text">之间</span>
                                    </template>
                                    <template v-if="citem.timeType == 2">
                                      <span class="devider-text">在</span>
                                      <a-input-number
                                    class="input width60" :min="0" v-model="citem.timeval" @change="
                                      (value) =>
                                        inputChange(value, 'two', 'timeval', index,cindex)
                                    " />
                                      <span class="devider-text">天</span>
                                      <a-select
                                        v-model="citem.rangeType"
                                        style="width: 80px"
                                      >
                                        <a-select-option value="1"
                                          >之内</a-select-option
                                        >
                                        <a-select-option value="2"
                                          >之前</a-select-option
                                        >
                                      </a-select>
                                    </template>
                                    <template v-if="citem.timeType == 3">
                                      <span class="devider-text">在过去</span>
                                      <a-input-number
                                    class="input width60" :min="0" v-model="citem.numSval" @change="
                                      (value) =>
                                        inputChange(value, 'two', 'numSval', index,cindex)
                                    " />
                                      <span class="devider-text">天到过去</span>
                                      <a-input-number
                                    class="input width60" :min="0" v-model="citem.numEval" @change="
                                      (value) =>
                                        inputChange(value, 'two', 'numEval', index,cindex)
                                    " />
                                      <span class="devider-text">天之内</span>
                                    </template>
                                    <template v-if="citem.timeType == 4">
                                      <span class="devider-text">在</span>
                                      <a-date-picker
                                        inputReadOnly
                                        v-model="citem.timestamp"
                                        @change="
                                          (date) =>
                                            timeOnChange(
                                              date,
                                              'two',
                                              index,
                                              cindex
                                            )
                                        "
                                      />
                                      <a-select
                                        v-model="citem.rangeType1"
                                        style="width: 80px; margin-left: 5px"
                                      >
                                        <a-select-option value="1"
                                          >之前</a-select-option
                                        >
                                        <a-select-option value="2"
                                          >之后</a-select-option
                                        >
                                      </a-select>
                                    </template>
                                  </template>
                                </div>
                                <span class="condition-list-icon">
                                  <a-icon
                                    type="plus-square"
                                    style="cursor: pointer"
                                    v-if="cindex == item.children.length - 1"
                                    @click="addList('user', 'two', index)"
                                  />
                                  <svg
                                    class="icon"
                                    aria-hidden="true"
                                    style="cursor: pointer; margin-left: 10px"
                                    @click="delList('two', index, cindex)"
                                  >
                                    <use xlink:href="#icon-shanchu" />
                                  </svg>
                                </span>
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                      <!-- 行为属性 -->
                      <div class="condition-list">
                        <div class="condition-list-item">
                          <span class="condition-list-text">用户行为满足</span>
                          <a-button @click="addList('behavior', 'one')"
                            >添加</a-button
                          >
                        </div>
                      </div>
                    </div>
                    <div style="text-align: center; margin-top: 50px">
                      <a-button @click="$openNewPage(1,'/inquire/userportrait/map')">定位周边分析</a-button>
                      <a-button
                        type="primary"
                        @click="searchClick"
                        style="
                          width: 120px;
                          margin-right: 10px;
                          margin-left: 10px;
                        "
                        >检索</a-button
                      >
                      <a-button @click="reset">重置条件</a-button>
                    </div>
                  </div>
                </div>
              </div>
              <!-- 检索用户--检索结果 -->
              <div class="model-container" v-if="tabKey == '1'">
                <div class="model-bg">
                  <div class="section-title clearfix">
                    <div
                      class="desc float-left"
                      v-if="trueTotal"
                      style="line-height: 1.5; padding: 17px 0"
                    >
                      检索到用户共
                      <span class="main-font">{{ trueTotal }}</span
                      >个
                    </div>
                    <div class="float-right">
                      <a-button>创建为用户分群</a-button>
                    </div>
                  </div>
                </div>
              </div>
              <!-- 检索用户--列表 -->
              <div class="model-container" v-if="tabKey == '1'">
                <div
                  class="model-bg"
                  style="
                    min-height: 400px;
                    position: relative;
                    padding-bottom: 75px;
                  "
                >
                  <div class="section-title">检索结果</div>
                  <div class="table">
                    <table style="table-layout: fixed">
                      <colgroup>
                        <col width="80" />
                        <col width="120" />
                        <col width="100" />
                        <col width="80" />
                        <col width="80" />
                        <col width="150" />
                        <col width="100" />
                        <col width="100" />
                        <col width="100" />
                        <col width="140" />
                      </colgroup>
                      <thead>
                        <tr>
                          <td>用户</td>
                          <td>姓名</td>
                          <td>手机号</td>
                          <td>自然性别</td>
                          <td>购物性别</td>
                          <td>手机系统</td>
                          <td style="text-align: right">微店注册时间</td>
                          <td style="text-align: right">火把注册时间</td>
                          <td style="text-align: right">首次下单时间</td>
                          <td style="text-align: right">操作</td>
                        </tr>
                      </thead>
                      <tbody v-if="userList.length > 0">
                        <tr v-for="(item, index) in userList" :key="index">
                          <td>{{ item.reader_id }}</td>
                          <td>
                            <span class="main-font">{{
                              item.realname ? item.realname : "--"
                            }}</span>
                          </td>
                          <td>
                            <span class="main-font">{{
                              item.mobile ? item.mobile : "--"
                            }}</span>
                          </td>
                          <td>
                            {{
                              item.reader_attr_sex ? item.reader_attr_sex : "--"
                            }}
                          </td>
                          <td>
                            {{
                              item.reader_attr_sex_shop
                                ? item.reader_attr_sex_shop
                                : "--"
                            }}
                          </td>
                          <td>
                            {{
                              item.reader_attr_device_sys
                                ? item.reader_attr_device_sys
                                : "--"
                            }}
                          </td>
                          <td style="text-align: right">--</td>
                          <td style="text-align: right">
                            {{
                              item.reader_attr_register_hb
                                ? item.reader_attr_register_hb
                                : "--"
                            }}
                          </td>
                          <td style="text-align: right">
                            {{
                              item.reader_cns_first_book
                                ? item.reader_cns_first_book
                                : "--"
                            }}
                          </td>
                          <td style="text-align: right">
                            <span class="click-font" @click="$openNewPage(1,'/inquire/userportrait/portrait?readerID='+item.reader_id)"
                              >详情</span
                            >
                          </td>
                        </tr>
                      </tbody>
                      <tbody v-else>
                        <tr>
                          <td colspan="10" style="text-align: center">
                            <div style="margin-top: 80px"><a-empty /></div>
                          </td>
                        </tr>
                      </tbody>
                    </table>
                  </div>
                  <!-- 分页 -->
                  <div class="pagination" v-if="userList.length > 0">
                    <a-pagination
                      :show-total="
                        (total) =>
                          `共 ${
                            trueTotal > 2000 ? 2000 + '+' : trueTotal
                          } 条数据`
                      "
                      :default-current="1"
                      v-model="page"
                      :total="total"
                      :defaultPageSize="pageSize"
                      @change="onShowSizeChange"
                    />
                  </div>
                </div>
              </div>
              <!-- 用户分群 -->
              <div class="model-container" v-if="tabKey == '2'">
                <div class="model-bg clearfix" style="padding: 10px 15px">
                  <div class="float-left">
                    <a-input
                      placeholder="搜索分群名称"
                      v-model="inputVal"
                      style="width: 300px"
                    />
                  </div>
                  <div class="float-right">
                    <a-button type="primary" style="width: 120px"
                      >检索</a-button
                    >
                  </div>
                </div>
              </div>
              <!-- 用户分群--列表 -->
              <div class="model-container" v-if="tabKey == '2'">
                <div
                  class="model-bg"
                  style="min-height: 536px; position: relative"
                >
                  <div class="section-title clearfix">
                    <div class="float-left">用户分群</div>
                    <div class="float-right">
                      <a-button type="primary">导入分群</a-button>
                    </div>
                  </div>
                  <div class="table">
                    <table style="table-layout: fixed">
                      <colgroup>
                        <col width="210" />
                        <col width="200" />
                        <col width="100" />
                        <col width="200" />
                        <col width="200" />
                        <col width="140" />
                      </colgroup>
                      <thead>
                        <tr>
                          <td>分群名称</td>
                          <td>人数</td>
                          <td>类型</td>
                          <td>更新方式</td>
                          <td style="text-align: right">创建者</td>
                          <td style="text-align: right">操作</td>
                        </tr>
                      </thead>
                      <tbody>
                        <tr>
                          <td>人类高质量读者</td>
                          <td>
                            <div>3</div>
                            <div>2021-08-10 17:52:07</div>
                          </td>
                          <td>规则创建</td>
                          <td>手动更新</td>
                          <td style="text-align: right">
                            <div>张三</div>
                            <div>15088658807</div>
                          </td>
                          <td style="text-align: right">
                            <span class="click-font">规则</span>
                            <span class="click-font" style="margin-left: 15px"
                              >删除</span
                            >
                          </td>
                        </tr>
                      </tbody>
                    </table>
                  </div>
                </div>
              </div>
            </div>
          </div>
          <div class="main-container" v-else>
            <div class="model-container">
              <div
                class="model-bg"
                style="
                  min-height: 660px;
                  padding-bottom: 75px;
                  position: relative;
                "
              >
                <PageNoPower></PageNoPower>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <Loading ref="load" :show="1" :isLoading="isLoading"></Loading>
  </div>
</template>
<style lang="scss" src="@/style/scss/pages/inquire/portrait.scss" scoped></style>
<script>
import { READER_TAG_LISTS, READER_SEARCH } from "../../../apis/inquire";
export default {
  data() {
    return {
      pagePower: true,
      tabKey: "1",
      attributeList: [],
      behaviorList: [],
      conditionList: [],
      satisfyList: [],
      strList: [
        { name: "包含", id: "1" },
        { name: "不包含", id: "2" },
        { name: "有值", id: "3" },
        { name: "无值", id: "4" },
      ],
      timeList: [
        { name: "绝对时间", id: "1" },
        { name: "相对当前时间点", id: "2" },
        { name: "相对当前时间区间", id: "3" },
        { name: "相对自定义时间点", id: "4" },
        { name: "有值", id: "5" },
        { name: "无值", id: "6" },
      ],
      numList: [
        { name: "等于", id: "1" },
        { name: "不等于", id: "2" },
        { name: "小于", id: "3" },
        { name: "小于等于", id: "4" },
        { name: "大于", id: "5" },
        { name: "大于等于", id: "6" },
        { name: "区间", id: "7" },
        { name: "有值", id: "8" },
        { name: "无值", id: "9" },
      ],
      relaType: "and",
      userRelaType: "and",
      total: 0,
      trueTotal: 0,
      page: 1,
      pageSize: 5,
      userList: [],
      setInfo: {},
      inputVal: "",
      isLoading: true,
      searchVal: "",
    };
  },
  mounted() {
    this.getData();
  },
  methods: {
    async getData() {
      var tStamp = this.$getTimeStamp();
      let data = {
        organization_id: this.$refs.head.publishInfo.organization_id,
        timestamp: tStamp,
      };
      data.sign = this.$getSign(data);
      let res = await READER_TAG_LISTS(data);
      if (res.code == 0) {
        this.pagePower = true;
        this.attributeList = res.data.attribute.map((value) => {
          if (value.type == 2) {
            value.option = value.option.map((v) => {
              return {
                id: v,
                name: v,
              };
            });
          }
          return value;
        });
        this.behaviorList = res.data.behavior;
        this.$nextTick(() => {
          this.isLoading = false;
        });
      } else {
        this.isLoading = false;
        if (res.code == 1009) {
          this.pagePower = false;
        } else {
          this.$refs.head.globalTip(1, res.message, res.code);
        }
      }
    },
    // 搜索结果
    async searchData() {
      var tStamp = this.$getTimeStamp();
      let data = {
        organization_id: this.$refs.head.publishInfo.organization_id,
        timestamp: tStamp,
        search: this.searchVal,
        page: this.page,
        page_size: this.pageSize,
      };
      data.sign = this.$getSign(data);
      let res = await READER_SEARCH(data);
      if (res.code == 0) {
        this.pagePower = true;
        this.userList = res.data.lists;
        this.trueTotal = res.data.count;
        this.total = res.data.count > 2000 ? 2000 : res.data.count;
        this.$nextTick(() => {
          this.isLoading = false;
        });
      } else {
        this.isLoading = false;
        if (res.code == 1009) {
          this.pagePower = false;
        } else {
          this.$refs.head.globalTip(1, res.message, res.code);
        }
      }
    },
    callback(key) {
      this.tabKey = key;
    },
    // 添加检索选项
    addList(realtion, type, index) {
      if (realtion == "user") {
        let _obj = {
          targID: this.attributeList[0].tag_id,
          searchType: this.attributeList[0].type,
          strType: "1",
          selectList: this.attributeList[0].option,
          name: this.attributeList[0].name,
          children: [],
          realType: "and",
          choose: [],
        };
        if (type == "one") {
          this.conditionList.push(_obj);
        } else if (type == "two") {
          this.conditionList[index].children.push(_obj);
        }
      } else if (realtion == "behavior") {
      }
    },
    // 删除检索选项
    delList(type, index, cindex) {
      if (type == "one") {
        this.conditionList.splice(index, 1);
      } else if (type == "two") {
        if (cindex == -1) {
          let _obj = JSON.parse(
            JSON.stringify(this.conditionList[index].children[0])
          );
          this.conditionList = this.conditionList.map((val, key) => {
            if (key == index) {
              val = _obj;
            }
            return val;
          });
        } else {
          this.conditionList[index].children.splice(cindex, 1);
        }
      }
    },
    // 第一项下拉切换
    handleTargeChange(value, type, index, cindex) {
      if (type == "one") {
        this.attributeList.map((val) => {
          if (val.tag_id == value) {
            this.conditionList[index].name = val.name;
            this.conditionList[index].selectList = [];
            this.conditionList[index].searchType = val.type;
            this.conditionList[index].strType = "1";
            this.conditionList[index].timeType = "1";
            this.conditionList[index].numType = "1";
            this.conditionList[index].rangeType = "1";
            this.conditionList[index].rangeType1 = "1";
            this.conditionList[index].choose = [];
            this.conditionList[index].chooseID = [];
            this.conditionList[index].selectList = val.option;
            this.conditionList[index].numVal = "";
            this.conditionList[index].numSval = "";
            this.conditionList[index].numEval = "";
            this.conditionList[index].stime = null;
            this.conditionList[index].etime = null;
            this.conditionList[index].timeval = "";
            this.conditionList[index].timestamp = null;
          }
        });
      } else if (type == "two") {
        this.attributeList.map((val) => {
          if (val.tag_id == value) {
            this.conditionList[index].children[cindex].name = val.name;
            this.conditionList[index].children[cindex].choose = [];
            this.conditionList[index].children[cindex].chooseID = [];
            this.conditionList[index].children[cindex].searchType = val.type;
            this.conditionList[index].children[cindex].strType = "1";
            this.conditionList[index].children[cindex].timeType = "1";
            this.conditionList[index].children[cindex].numType = "1";
            this.conditionList[index].children[cindex].rangeType = "1";
            this.conditionList[index].children[cindex].rangeType1 = "1";
            this.conditionList[index].children[cindex].selectList = val.option;
            this.conditionList[index].children[cindex].numVal = "";
            this.conditionList[index].children[cindex].numSval = "";
            this.conditionList[index].children[cindex].numEval = "";
            this.conditionList[index].children[cindex].stime = null;
            this.conditionList[index].children[cindex].etime = null;
            this.conditionList[index].children[cindex].timeval = "";
            this.conditionList[index].children[cindex].timestamp = null;
          }
        });
      }
    },
    // 字符串或字典下拉切换
    handleStrChange(value, type, index, cindex) {
      if (type == "one") {
        this.conditionList = this.conditionList.map((val, key) => {
          if (key == index) {
            val.choose = [];
            val.chooseID = [];
            val.strType = value;
          }
          return val;
        });
      } else if (type == "two") {
        this.conditionList = this.conditionList.map((val, key) => {
          if (key == index) {
            val.children[cindex].choose = [];
            val.children[cindex].chooseID = [];
            val.children[cindex].strType = value;
          }
          return val;
        });
      }
    },
    // 数值下拉切换
    handleNumChange(value, type, index, cindex) {
      if (type == "one") {
        this.conditionList = this.conditionList.map((val, key) => {
          if (key == index) {
            val.numVal = "";
            val.numSval = "";
            val.numEval = "";
            val.numType = value;
          }
          return val;
        });
      } else if (type == "two") {
        this.conditionList = this.conditionList.map((val, key) => {
          if (key == index) {
            val.children[cindex].numVal = "";
            val.children[cindex].numSval = "";
            val.children[cindex].numEval = "";
            val.children[cindex].numType = value;
          }
          return val;
        });
      }
    },
    // 时间下拉切换
    handleTimeChange(value, type, index, cindex) {
      if (type == "one") {
        this.conditionList = this.conditionList.map((val, key) => {
          if (key == index) {
            val.timeval = "";
            val.stime = null;
            val.etime = null;
            val.numSval = "";
            val.numEval = "";
            val.timeType = value;
            val.timestamp = null;
            val.rangeType = "1";
            val.rangeType1 = "1";
          }
          return val;
        });
      } else if (type == "two") {
        this.conditionList = this.conditionList.map((val, key) => {
          if (key == index) {
            val.children[cindex].timeval = "";
            val.children[cindex].stime = null;
            val.children[cindex].etime = null;
            val.children[cindex].numSval = "";
            val.children[cindex].numEval = "";
            val.children[cindex].timeType = value;
            val.children[cindex].timestamp = null;
            val.children[cindex].rangeType = "1";
            val.children[cindex].rangeType1 = "1";
          }
          return val;
        });
      }
    },
    // 标签选择
    selectChange(value, type, item, index, cindex) {
      let _arr = [];
      value.map((val) => {
        item.selectList.map((v) => {
          if (v.name == val) {
            _arr.push(v.id);
          }
        });
      });
      if (type == "one") {
        this.conditionList = this.conditionList.map((val, key) => {
          if (key == index) {
            val.choose = _arr;
            val.chooseID = value;
          }
          return val;
        });
      } else if (type == "two") {
        this.conditionList = this.conditionList.map((val, key) => {
          if (key == index) {
            val.children[cindex].choose = _arr;
            val.children[cindex].chooseID = value;
          }
          return val;
        });
      }
    },
    // 时间范围选择
    onChange(date, type, index, cindex) {
      let s_time, e_time;
      if (date.length > 0) {
        s_time = date[0];
        e_time = date[1];
      } else {
        s_time = null;
        e_time = null;
      }
      if (type == "one") {
        this.conditionList = this.conditionList.map((val, key) => {
          if (key == index) {
            val.stime = s_time;
            val.etime = e_time;
          }
          return val;
        });
      } else if (type == "two") {
        this.conditionList = this.conditionList.map((val, key) => {
          if (key == index) {
            val.children[cindex].stime = s_time;
            val.children[cindex].etime = e_time;
          }
          return val;
        });
      }
    },
    // 单个时间选择
    timeOnChange(date, type, index, cindex) {
      let _time;
      if (date) {
        _time = date;
      } else {
        _time = null;
      }
      if (type == "one") {
        this.conditionList = this.conditionList.map((val, key) => {
          if (key == index) {
            val.timestamp = _time;
          }
          return val;
        });
      } else if (type == "two") {
        this.conditionList = this.conditionList.map((val, key) => {
          if (key == index) {
            val.children[cindex].timestamp = _time;
          }
          return val;
        });
      }
    },
    // 输入框
    inputChange(value, type, itype, index, cindex) {
      // console.log(value,type,itype,index,cindex);
      let _val = value;
      if (type == "one") {
        this.conditionList = this.conditionList.map((val, key) => {
          if (key == index) {
            switch (itype) {
              case "numVal":
                val.numVal = _val;
                break;
              case "numSval":
                val.numSval = _val;
                break;
              case "numEval":
                val.numEval = _val;
                break;
              case "timeval":
                val.timeval = _val;
                break;
            }
          }
          return val;
        });
      } else if (type == "two") {
        this.conditionList = this.conditionList.map((val, key) => {
          if (key == index) {
            switch (itype) {
              case "numVal":
                val.children[cindex].numVal = _val;
                break;
              case "numSval":
                val.children[cindex].numSval = _val;
                break;
              case "numEval":
                val.children[cindex].numEval = _val;
                break;
              case "timeval":
                val.children[cindex].timeval = _val;
                break;
            }
          }
          return val;
        });
      }
    },
    checkType(index) {
      this.conditionList[index].realType =
        this.conditionList[index].realType == "and" ? "or" : "and";
    },
    // 重置
    reset() {
      this.page = 1;
      this.conditionList = [];
      // this.userList = [];
    },
    // 搜索
    searchClick() {
      let _val = {
        lists: [],
        type: this.userRelaType,
      };
      if (this.conditionList.length == 0 && this.satisfyList.length == 0) {
        this.$refs.head.globalTip(1, "请添加检索条件！", 0);
        return false;
      }
      let _check = true,_num = 0;
      this.conditionList.map((value, key) => {
        _num++;
        let _obj = {};
        _obj.tag_id = value.targID;
        _obj.tag_type = value.searchType;
        if (value.searchType == 1 || value.searchType == 5) {
          if (value.numType != 7 && value.numType != 8 && value.numType != 9) {
            if (!value.numVal) {
              this.$refs.head.globalTip(
                1,
                "请输入用户属性第" + (key + 1) + "组["+value.name+"]的数值！",
                0
              );
              _check = false;
              return false;
            }
            if (Object.is(NaN, Number(value.numVal))) {
              this.$refs.head.globalTip(
                1,
                "用户属性第" + (key + 1) + "组["+value.name+"]的值需为数字类型！",
                0
              );
              _check = false;
              return false;
            }
          }
          if (value.numType == 1) {
            _obj.equal = Number(value.numVal);
          } else if (value.numType == 2) {
            _obj.not_equal = Number(value.numVal);
          } else if (value.numType == 3) {
            _obj.lt = Number(value.numVal);
          } else if (value.numType == 4) {
            _obj.lte = Number(value.numVal);
          } else if (value.numType == 5) {
            _obj.gt = Number(value.numVal);
          } else if (value.numType == 6) {
            _obj.gte = Number(value.numVal);
          } else if (value.numType == 7) {
            if (!value.numSval || !value.numEval) {
              this.$refs.head.globalTip(
                1,
                "请输入用户属性第" + (key + 1) + "组["+value.name+"]的数值！",
                0
              );
              _check = false;
              return false;
            }
            if (
              Object.is(NaN, Number(value.numSval)) ||
              Object.is(NaN, Number(value.numEval))
            ) {
              this.$refs.head.globalTip(
                1,
                "用户属性第" + (key + 1) + "组["+value.name+"]的值需为数字类型！",
                0
              );
              _check = false;
              return false;
            }
            _obj.gt = Number(value.numSval);
            _obj.lt = Number(value.numEval);
          } else if (value.numType == 8) {
            _obj.is_not_null = 1;
          } else if (value.numType == 9) {
            _obj.is_null = 1;
          }
        } else if (value.searchType == 2 || value.searchType == 4) {
          if (value.strType == 1) {
            if (value.choose.length == 0) {
              this.$refs.head.globalTip(
                1,
                "请选择用户属性第" + (key + 1) + "组["+value.name+"]的标签！",
                0
              );
              _check = false;
              return false;
            }
            _obj.equal = value.choose.join("|");
          } else if (value.strType == 2) {
            if (value.choose.length == 0) {
              this.$refs.head.globalTip(
                1,
                "请选择用户属性第" + (key + 1) + "组["+value.name+"]的标签！",
                0
              );
              _check = false;
              return false;
            }
            _obj.not_equal = value.choose.join("|");
          } else if (value.strType == 3) {
            _obj.is_not_null = 1;
          } else if (value.strType == 4) {
            _obj.is_null = 1;
          }
        } else if (value.searchType == 3) {
          if (value.timeType == 1) {
            if (!value.stime || !value.etime) {
              this.$refs.head.globalTip(
                1,
                "请选择用户属性第" + (key + 1) + "组["+value.name+"]的时间范围！",
                0
              );
              _check = false;
              return false;
            }
            _obj.gt = value.stime.startOf("day").valueOf() / 1000;
            _obj.lt = value.etime.startOf("day").valueOf() / 1000;
          } else if (value.timeType == 2) {
            if (!value.timeval) {
              this.$refs.head.globalTip(
                1,
                "请输入用户属性第" + (key + 1) + "组["+value.name+"]的数值！",
                0
              );
              _check = false;
              return false;
            }
            if (Object.is(NaN, Number(value.timeval))) {
              this.$refs.head.globalTip(
                1,
                "用户属性第" + (key + 1) + "组["+value.name+"]的值需为数字类型！",
                0
              );
              _check = false;
              return false;
            }
            if (value.rangeType == 1) {
              _obj.lte = this.$moment().startOf("day").valueOf() / 1000;
              _obj.gte =
                this.$moment()
                  .subtract(Number(value.timeval), "days")
                  .startOf("day")
                  .valueOf() / 1000;
            } else if (value.rangeType == 2) {
              _obj.lt =
                this.$moment()
                  .subtract(Number(value.timeval), "days")
                  .startOf("day")
                  .valueOf() / 1000;
            }
          } else if (value.timeType == 3) {
            if (!value.numSval || !value.numEval) {
              this.$refs.head.globalTip(
                1,
                "请输入用户属性第" + (key + 1) + "组["+value.name+"]的数值范围！",
                0
              );
              _check = false;
              return false;
            }
            if (
              Object.is(NaN, Number(value.numSval)) ||
              Object.is(NaN, Number(value.numEval))
            ) {
              this.$refs.head.globalTip(
                1,
                "用户属性第" + (key + 1) + "组["+value.name+"]的值需为数字类型！",
                0
              );
              _check = false;
              return false;
            }
            if (Number(value.numSval) > Number(value.numEval)) {
              _obj.lt =
                this.$moment()
                  .subtract(Number(value.numEval), "days")
                  .startOf("day")
                  .valueOf() / 1000;
              _obj.gt =
                this.$moment()
                  .subtract(Number(value.numSval), "days")
                  .startOf("day")
                  .valueOf() / 1000;
            } else {
              _obj.lt =
                this.$moment()
                  .subtract(Number(value.numSval), "days")
                  .startOf("day")
                  .valueOf() / 1000;
              _obj.gt =
                this.$moment()
                  .subtract(Number(value.numEval), "days")
                  .startOf("day")
                  .valueOf() / 1000;
            }
          } else if (value.timeType == 4) {
            if (!value.timestamp) {
              this.$refs.head.globalTip(
                1,
                "请选择用户属性第" + (key + 1) + "组["+value.name+"]的时间点！",
                0
              );
              _check = false;
              return false;
            }
            if (value.rangeType1 == 1) {
              _obj.lt = value.timestamp.startOf("day").valueOf() / 1000;
            } else if (value.rangeType1 == 2) {
              _obj.gt = value.timestamp.startOf("day").valueOf() / 1000;
            }
          } else if (value.timeType == 5) {
            _obj.is_not_null = 1;
          } else if (value.timeType == 6) {
            _obj.is_null = 1;
          }
        }
        if (value.children.length > 0) {
          // let p_obj = JSON.parse(JSON.stringify(_obj));
          let p_obj = {
            type: value.realType,
            lists: [],
          };
          value.children.map((v, k) => {
            _num++;
            let c_obj = {};
            c_obj.tag_id = v.targID;
            c_obj.tag_type = v.searchType;
            if (v.searchType == 1 || v.searchType == 5) {
              if (v.numType != 7 && v.numType != 8 && v.numType != 9) {
                if (!v.numVal) {
                  this.$refs.head.globalTip(
                    1,
                    "请输入用户属性第" +
                      (key + 1) +
                      "组第" +
                      (k + 2) +
                      "行["+v.name+"]的数值！",
                    0
                  );
                  _check = false;
                  return false;
                }
                if (Object.is(NaN, Number(v.numVal))) {
                  this.$refs.head.globalTip(
                    1,
                    "用户属性第" +
                      (key + 1) +
                      "组第" +
                      (k + 2) +
                      "行["+v.name+"]的值需为数字类型！",
                    0
                  );
                  _check = false;
                  return false;
                }
              }
              if (v.numType == 1) {
                c_obj.equal = Number(v.numVal);
              } else if (v.numType == 2) {
                c_obj.not_equal = Number(v.numVal);
              } else if (v.numType == 3) {
                c_obj.lt = Number(v.numVal);
              } else if (v.numType == 4) {
                c_obj.lte = Number(v.numVal);
              } else if (v.numType == 5) {
                c_obj.gt = Number(v.numVal);
              } else if (v.numType == 6) {
                c_obj.gte = Number(v.numVal);
              } else if (v.numType == 7) {
                if (!v.numSval || !v.numEval) {
                  this.$refs.head.globalTip(
                    1,
                    "请输入用户属性第" +
                      (key + 1) +
                      "组第" +
                      (k + 2) +
                      "行["+v.name+"]的数值！",
                    0
                  );
                  _check = false;
                  return false;
                }
                if (
                  Object.is(NaN, Number(v.numSval)) ||
                  Object.is(NaN, Number(v.numEval))
                ) {
                  this.$refs.head.globalTip(
                    1,
                    "用户属性第" +
                      (key + 1) +
                      "组第" +
                      (k + 2) +
                      "行["+v.name+"]的值需为数字类型！",
                    0
                  );
                  _check = false;
                  return false;
                }
                c_obj.gt = Number(v.numSval);
                c_obj.lt = Number(v.numEval);
              } else if (v.numType == 8) {
                c_obj.is_not_null = 1;
              } else if (v.numType == 9) {
                c_obj.is_null = 1;
              }
            } else if (v.searchType == 2 || v.searchType == 4) {
              if (v.strType == 1) {
                if (v.choose.length == 0) {
                  this.$refs.head.globalTip(
                    1,
                    "请选择用户属性第" +
                      (key + 1) +
                      "组第" +
                      (k + 2) +
                      "行["+v.name+"]的标签！",
                    0
                  );
                  _check = false;
                  return false;
                }
                c_obj.equal = v.choose.join("|");
              } else if (v.strType == 2) {
                if (v.choose.length == 0) {
                  this.$refs.head.globalTip(
                    1,
                    "请选择用户属性第" +
                      (key + 1) +
                      "组第" +
                      (k + 2) +
                      "行["+v.name+"]的标签！",
                    0
                  );
                  _check = false;
                  return false;
                }
                c_obj.not_equal = v.choose.join("|");
              } else if (v.strType == 3) {
                c_obj.is_not_null = 1;
              } else if (v.strType == 4) {
                c_obj.is_null = 1;
              }
            } else if (v.searchType == 3) {
              if (v.timeType == 1) {
                if (!v.stime || !v.etime) {
                  this.$refs.head.globalTip(
                    1,
                    "请选择用户属性第" +
                      (key + 1) +
                      "组第" +
                      (k + 2) +
                      "行["+v.name+"]的时间范围！",
                    0
                  );
                  _check = false;
                  return false;
                }
                c_obj.gt = v.stime.startOf("day").valueOf() / 1000;
                c_obj.lt = v.etime.startOf("day").valueOf() / 1000;
              } else if (v.timeType == 2) {
                if (!v.timeval) {
                  this.$refs.head.globalTip(
                    1,
                    "请输入用户属性第" +
                      (key + 1) +
                      "组第" +
                      (k + 2) +
                      "行["+v.name+"]的数值！",
                    0
                  );
                  _check = false;
                  return false;
                }
                if (Object.is(NaN, Number(v.timeval))) {
                  this.$refs.head.globalTip(
                    1,
                    "用户属性第" +
                      (key + 1) +
                      "组第" +
                      (k + 2) +
                      "行["+v.name+"]的值需为数字类型！",
                    0
                  );
                  _check = false;
                  return false;
                }
                if (v.rangeType == 1) {
                  c_obj.lte = this.$moment().startOf("day").valueOf() / 1000;
                  c_obj.gte =
                    this.$moment()
                      .subtract(Number(v.timeval), "days")
                      .startOf("day")
                      .valueOf() / 1000;
                } else if (v.rangeType == 2) {
                  c_obj.lt =
                    this.$moment()
                      .subtract(Number(v.timeval), "days")
                      .startOf("day")
                      .valueOf() / 1000;
                }
              } else if (v.timeType == 3) {
                if (!v.numSval || !v.numEval) {
                  this.$refs.head.globalTip(
                    1,
                    "请输入用户属性第" +
                      (key + 1) +
                      "组第" +
                      (k + 2) +
                      "行["+v.name+"]的数值范围！",
                    0
                  );
                  _check = false;
                  return false;
                }
                if (
                  Object.is(NaN, Number(v.numSval)) ||
                  Object.is(NaN, Number(v.numEval))
                ) {
                  this.$refs.head.globalTip(
                    1,
                    "用户属性第" +
                      (key + 1) +
                      "组第" +
                      (k + 2) +
                      "行["+v.name+"]的值需为数字类型！",
                    0
                  );
                  _check = false;
                  return false;
                }
                if (Number(v.numSval) > Number(v.numEval)) {
                  c_obj.lt =
                    this.$moment()
                      .subtract(Number(v.numEval), "days")
                      .startOf("day")
                      .valueOf() / 1000;
                  c_obj.gt =
                    this.$moment()
                      .subtract(Number(v.numSval), "days")
                      .startOf("day")
                      .valueOf() / 1000;
                } else {
                  c_obj.lt =
                    this.$moment()
                      .subtract(Number(v.numSval), "days")
                      .startOf("day")
                      .valueOf() / 1000;
                  c_obj.gt =
                    this.$moment()
                      .subtract(Number(v.numEval), "days")
                      .startOf("day")
                      .valueOf() / 1000;
                }
              } else if (v.timeType == 4) {
                if (!v.timestamp) {
                  this.$refs.head.globalTip(
                    1,
                    "请选择用户属性第" +
                      (key + 1) +
                      "组第" +
                      (k + 2) +
                      "行["+v.name+"]的时间点！",
                    0
                  );
                  _check = false;
                  return false;
                }
                if (v.rangeType1 == 1) {
                  c_obj.lt = v.timestamp.startOf("day").valueOf() / 1000;
                } else if (v.rangeType1 == 2) {
                  c_obj.gt = v.timestamp.startOf("day").valueOf() / 1000;
                }
              } else if (v.timeType == 5) {
                c_obj.is_not_null = 1;
              } else if (v.timeType == 6) {
                c_obj.is_null = 1;
              }
            }
            p_obj.lists.push(_obj);
            p_obj.lists.push(c_obj);
          });
          _val.lists.push(p_obj);
        } else {
          _val.lists.push(_obj);
        }
      });
      console.log(5656, _val, _num);
      if (!_check) {
        return false;
      }
      if (_num > 20) {
        this.$refs.head.globalTip(1, "检索条件不能超过20条！", 0);
        return false;
      }
      this.searchVal = JSON.stringify(_val);
      this.isLoading = true;
      this.page = 1;
      this.searchData();
    },
    onShowSizeChange(page) {
      this.isLoading = true;
      this.page = page;
      this.searchData();
    },
  },
};
</script>